require 'scanner/states/state'
require 'scanner/states/start_state'

class StringState < State
  @token_type = :String
  @complete = false

  def self.next_state(char)
    if @complete
      @complete = false
      # Chop off the trailing quote mark
      @token.literal = @token.literal[0..-2]
      return StartState
    else
      @complete = true if char == '"'
      return StringState
    end
  end
end